import os
import sys
from pathlib import Path

# 基础配置
# APP_NAME = "WS_Notifier"
APP_NAME = "工作台通知助手"
APP_VERSION = "1.0.0"
ROOT_DIR = Path(__file__).parent.absolute()

# 资源文件
ASSETS_DIR = ROOT_DIR / "ws_notifier" / "gui" / "assets"
ICON_PATH = ASSETS_DIR / ("icon.ico" if sys.platform == "win32" else "icon.icns")

# 通用配置
COMMON_CONFIG = {
    'name': APP_NAME,
    'debug': False,
    'strip': False,
    'upx': True,
    'console': False,
    'clean': True,
}

# 隐藏导入
HIDDEN_IMPORTS = [
    'websockets.legacy.client',
    'websockets.legacy.server',
    'websockets.legacy.protocol',
    'PIL._tkinter_finder',
    'requests',
    'win32com.client',
    'win32gui',
    'win32con',
    'win32api',
    'win32timezone',
]

# Windows 特定配置
WINDOWS_CONFIG = {
    **COMMON_CONFIG,
    'hidden_imports': HIDDEN_IMPORTS + [
        'pystray._win32',
        'win32gui',
        'win32con',
        'win32api',
        'win32timezone',
    ],
    'icon': str(ICON_PATH),
    'onefile': True,
    'noconsole': True,
    'runtime_hooks': [],
    'excludes': ['tkinter'],
}

# macOS 特定配置
MACOS_CONFIG = {
    **COMMON_CONFIG,
    'hidden_imports': HIDDEN_IMPORTS + [
        'pystray._darwin',
        'Foundation',
        'AppKit',
        'objc',
    ],
    'icon': str(ICON_PATH),
    'bundle_identifier': 'com.wsnotifier.app',
    'info_plist': {
        'CFBundleName': APP_NAME,
        'CFBundleDisplayName': APP_NAME,
        'CFBundleGetInfoString': 'WebSocket Notification Client',
        'CFBundleVersion': APP_VERSION,
        'CFBundleShortVersionString': APP_VERSION,
        'NSHighResolutionCapable': 'True',
        'LSUIElement': '1',
        'NSRequiresAquaSystemAppearance': 'True',
        'LSMinimumSystemVersion': '10.10.0',
        'NSAppleEventsUsageDescription': f'{APP_NAME} needs to send notifications',
        'NSNotificationsUsageDescription': f'{APP_NAME} needs to send notifications',
    }
} 